{extend name="../../admin/view/main"}

{block name="button"}
{/block}

{block name="content"}
<div class="layui-card padding-20 shadow">
    <div class="layui-card-body">
         
        <div class="layui-form-item">
            <div class="help-label"><b>{:lang('查看密码')}</b></div>
            <label class="relative block">
                <input readonly value="{$pass|default=''}" class="layui-input layui-bg-gray pass_val">
                <a lay-on="prompt" class="layui-icon layui-icon-release input-right-icon"></a>
            </label>
        </div>
        <div class="layui-form-item">
            <div class="help-label"><b>{:lang('设置访问IP')}</b></div>
            <label class="relative block">
                <input readonly value="{$ip_str|default=''}" class="layui-input layui-bg-gray ip_val">
                <a lay-on="vprompt" class="layui-icon layui-icon-release input-right-icon"></a>
            </label>
        </div>
        
    </div>
</div>
{/block}
{block name="script"}
<script>
    
  var util = layui.util;
  util.on('lay-on', {
    prompt: function(){
      layer.prompt({title: '修改查看密码', formType: 1}, function(pass, index){
          $.post('/fx/product.shop/alert_pass',{pass:pass},function(res){
              console.log(res);
              if(res=="y"){layer.close(index);$(".pass_val").val(pass);}
              else{layer.msg("修改失败，请刷新后重试");}
          })
      });
    },
    vprompt: function(){
      layer.prompt({title: '请输入ip,多个用"，"隔开', formType: 2,value:'{$ip_str|default=''}'}, function(value, index, elem){
          console.log(value);
        $.post('/fx/product.shop/alert_ip',{ip:value},function(res){
              console.log(res);
              if(res=="y"){layer.close(index);$(".ip_val").val(value);}
              else{layer.msg("修改失败，请刷新后重试");}
        })
      });
    },
  })
</script>
{/block}
    